package leecode

import "strings"

func removeDuplicates(s string) string {
	resultSlice := strings.Split(s, "")
	data := make([]string, 0, len(resultSlice))
	for _, value := range resultSlice {
		data = append(data, value)
		if len(data) != 0 && value == data[len(data)-1] {
			data = data[:len(data)-1]
		}
	}
	return strings.Join(data, "")
}
